import axios from 'axios';
import { createStore } from '../store/index'
axios.defaults.withCredentials = true;

let base = 'https://www.orient-trade.com/quotesDBUpdateBiBi'; //合约行情


axios.interceptors.response.use(function(response) {
    if (response.data.code == 225) {
        // this.
        console.log("请重新登录")
        // window.top.location.href = "http://www.morgan-ex.com/login"
    }
    return response;
}, function(error) {
    return Promise.reject(error);
});
// post请求
// export const login = params => { return axios.post(`${base}/user/login`, params).then(res => res) };
// 合约行情
export const get24hrDataForAgreement = params => { return axios.get(`${base}/quotations/get24hrDataForAgreement`, { params: params }).then(res => res) };

// 最新价：单一交易对
export const get24hrDataByTwoCoinName = params => { return axios.get(`${base}/quotations/get24hrDataByTwoCoinName`, { params: params }).then(res => res) };
// 买卖盘口及深度图:价格倒序
export const getBuySellData = params => { return axios.get(`${base}/quotations/getBuySellData`, { params: params }).then(res => res) };
// 近期成交
export const getDealRecord = params => { return axios.get(`${base}/quotations/getDealRecord`, { params: params }).then(res => res) };

